<!--
 * Copyright 2020 The Chromium Authors. All rights reserved.  Use of this
 * source code is governed by a BSD-style license that can be found in the
 * LICENSE file.
-->
<html>
<head>
<title>Automation Tests - TextArea Append Perf</title>
</head>
<body>

<button>Go</button>
<textarea id="testElement" spellcheck=false style="height:90vh"></textarea>
<a id="done" href="#">Done</a>

<script>
  let button = document.body.querySelector('button');
  button.addEventListener('click', () => {
    // Fill the textarea with 10 lines of random numbers,
    // 10 times, and then focus the 'done' link.
    let testElement = document.getElementById('testElement');
    function go(iteration) {
      if (iteration == 10) {
        document.getElementById('done').focus();
      } else {
        testElement.textContent += new Array(100).fill(0).map(
            (_, i) => Math.floor(100*Math.random())).join('\n');
        setTimeout(() => {
          go(iteration + 1);
        }, 0);
      }
    }
    go(0);
  });
</script>
</body>
</html>
